package method;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * @Author quan
 * @Description 将Service类注入到UseController类
 * @Date 2023/7/14 15:23
 */

/**
 * 构造函数注入:注入多个
 */
@Controller
public class UserController1 {
    private UserService1 userService1;
    private UserConfiguration1 configuration1;
    //构造函数
    public UserController1(UserService1 userService1) {
        System.out.println("111");
        this.userService1 = userService1;
    }
    @Autowired//表示使用的是这个构造函数
    public UserController1(UserService1 userService1, UserConfiguration1 configuration1) {
        System.out.println("222");
        this.userService1 = userService1;
        this.configuration1 = configuration1;
    }

    public void sayHi(){
        userService1.doService();
        configuration1.doConf();
        System.out.println("hi,userController1");
    }
}
